const app = new Vue({
    created: function (Vue) {
        this.firstGet();
    },
    el: "#todoapp",
    data: {
        list: ["写代码"],
        inputValue: ""
    },
    methods: {
        add: function () {
            this.list.push(this.inputValue);
            this.inputValue = "";
        },
        remove: function (index) {
            this.list.splice(index, 1);
        },
        clear: function () {
            this.list = [];
        },
        submit: function () {
            axios.post("/uptext", this.list).then(
                function (success) {
                    alert(success.data)
                }, function (error) {
                    alert(error.data)
                }
            )
        },
        firstGet: function () {
            axios.get("/uptext").then(
                (success) => this.list = success.data,
                (error) => alert("获取数据失败")
        )
        }
    }

})